<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<title>用户菜单管理</title>
<%@ include file="/common/meta.jsp"%>
<SCRIPT type="text/javascript">
	<!--
	var userResTreeObj = null;
	var zNodes =${resultJson};
	
	var setting = {
		check: {
			enable: true
		},
		data: {
			simpleData: {
				enable: true
			}
		}
	};
	
	function submitMainForm() {
		var cnn = userResTreeObj.getChangeCheckedNodes();
		var cnid = null;
		var i = null;
		for(i = 0; i < cnn.length; i++){
			cnid = cnid == null ? cnn[i].id : cnid + "," + cnn[i].id;
		}
		if(cnid){
			$("#r_res_check_id").val(cnid);
			mainForm.submit();
		}
	};
	
	$(document).ready(function(){
		userResTreeObj = $.fn.zTree.init($("#userResTree"), setting, zNodes);
		userResTreeObj.expandAll(true);
	});
	
		//-->
	</SCRIPT>
</head>

<body>
<%@ include file="/common/center-top.jsp"%>	
<!-- 网页主显示区，填写表单 -->
<table class="tableFrom" align="center" cellpadding="0" cellspacing="1">
	<tr>
		<td class="tdInput" style="width:100%" valign="top">
			<ul id="userResTree" class="ztree"></ul>
		</td>
	</tr>
	<tr>
		<td class="tdInput" style="width:100%" align="center" valign="top">
			<s:form action="/user/role!modifyRoleResource.action" name="mainForm" id="mainForm">
				<input type="hidden" name="role.id" value="${role.id}"/>
				<input type="hidden" id="r_res_check_id" name="checkResIds"/>
				<div style="width:100%;height:25;text-align: center;margin-top:5px;">
					<img src="${ctp}/images/xg.gif" onclick="submitMainForm()" style="cursor: pointer;"/>
				</div>
			</s:form>
		</td>
	</tr>
</table>
<%@ include file="/common/center-down.jsp"%>				
</body>
</html>
